﻿/*************************************************************************
 * Created by OhZee Creative, LLC
 * 2013
 * This code is licensed under Microsoft Public License (Ms-PL)
 * http://opensource.org/licenses/ms-pl
 * http://ozframework.codeplex.com/
 *************************************************************************/

namespace OhZeeCreative.Windows8.UnitTests
{
    using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
    using OhZeeCreative.Helpers;
    using System;
    using Windows.Foundation;

    [TestClass]
    public class LayoutHelperTest
    {
        private static readonly Point center = new Point(0.5, 0.5);
        private static readonly Point left = new Point(0.0, 0.5);
        private static readonly Point right = new Point(1.0, 0.5);
        private static readonly Point top = new Point(0.5, 0.0);
        private static readonly Point bottom = new Point(0.5, 1.0);
        private static readonly Point leftTop = new Point(0.0, 0.0);
        private static readonly Point rightTop = new Point(1.0, 0.0);
        private static readonly Point leftBottom = new Point(0.0, 1.0);
        private static readonly Point rightBottom = new Point(1.0, 1.0);

        private static readonly Size size = new Size(100.0, 60.0);

        private static double height30 = Math.Round(100.0 * Math.Sin(MathHelper.Radians(30)) + 60.0 * Math.Cos(MathHelper.Radians(30)), 2);
        private static double width30 = Math.Round(100.0 * Math.Cos(MathHelper.Radians(30)) + 60.0 * Math.Sin(MathHelper.Radians(30)), 2);

        private static double dim45 = Math.Round(100.0 * Math.Sqrt(2) * 0.5 + 60.0 * Math.Sqrt(2) * 0.5, 2);

        private static double height60 = Math.Round(100.0 * Math.Sin(MathHelper.Radians(60)) + 60.0 * Math.Cos(MathHelper.Radians(60)), 2);
        private static double width60 = Math.Round(100.0 * Math.Cos(MathHelper.Radians(60)) + 60.0 * Math.Sin(MathHelper.Radians(60)), 2);

        [TestMethod]
        public void TestSizes()
        {
            Size result = LayoutHelper.GetSizeAtAngle(size, 0.0);
            Assert.AreEqual(100.0, Math.Round(result.Width, 2));
            Assert.AreEqual(60.0, Math.Round(result.Height, 2));

            result = LayoutHelper.GetSizeAtAngle(size, 90.0);
            Assert.AreEqual(60.0, Math.Round(result.Width, 2));
            Assert.AreEqual(100.0, Math.Round(result.Height, 2));

            result = LayoutHelper.GetSizeAtAngle(size, -90.0);
            Assert.AreEqual(60.0, Math.Round(result.Width, 2));
            Assert.AreEqual(100.0, Math.Round(result.Height, 2));
                                    
            result = LayoutHelper.GetSizeAtAngle(size, 45.0);
            Assert.AreEqual(dim45, Math.Round(result.Width, 2));
            Assert.AreEqual(dim45, Math.Round(result.Height, 2));

            result = LayoutHelper.GetSizeAtAngle(size, 135.0);
            Assert.AreEqual(dim45, Math.Round(result.Width, 2));
            Assert.AreEqual(dim45, Math.Round(result.Height, 2));

            result = LayoutHelper.GetSizeAtAngle(size, 225.0);
            Assert.AreEqual(dim45, Math.Round(result.Width, 2));
            Assert.AreEqual(dim45, Math.Round(result.Height, 2));

            result = LayoutHelper.GetSizeAtAngle(size, 315.0);
            Assert.AreEqual(dim45, Math.Round(result.Width, 2));
            Assert.AreEqual(dim45, Math.Round(result.Height, 2));

            result = LayoutHelper.GetSizeAtAngle(size, 405.0);
            Assert.AreEqual(dim45, Math.Round(result.Width, 2));
            Assert.AreEqual(dim45, Math.Round(result.Height, 2));
            
            result = LayoutHelper.GetSizeAtAngle(size, -45.0);
            Assert.AreEqual(dim45, Math.Round(result.Width, 2));
            Assert.AreEqual(dim45, Math.Round(result.Height, 2));
                        
            result = LayoutHelper.GetSizeAtAngle(size, -135.0);
            Assert.AreEqual(dim45, Math.Round(result.Width, 2));
            Assert.AreEqual(dim45, Math.Round(result.Height, 2));

            result = LayoutHelper.GetSizeAtAngle(size, -225.0);
            Assert.AreEqual(dim45, Math.Round(result.Width, 2));
            Assert.AreEqual(dim45, Math.Round(result.Height, 2));

            result = LayoutHelper.GetSizeAtAngle(size, -315.0);
            Assert.AreEqual(dim45, Math.Round(result.Width, 2));
            Assert.AreEqual(dim45, Math.Round(result.Height, 2));

            result = LayoutHelper.GetSizeAtAngle(size, -405.0);
            Assert.AreEqual(dim45, Math.Round(result.Width, 2));
            Assert.AreEqual(dim45, Math.Round(result.Height, 2));


            result = LayoutHelper.GetSizeAtAngle(size, 30.0);
            Assert.AreEqual(width30, Math.Round(result.Width, 2));
            Assert.AreEqual(height30, Math.Round(result.Height, 2));

            result = LayoutHelper.GetSizeAtAngle(size, 60.0);
            Assert.AreEqual(width60, Math.Round(result.Width, 2));
            Assert.AreEqual(height60, Math.Round(result.Height, 2));

            result = LayoutHelper.GetSizeAtAngle(size, 120.0);
            Assert.AreEqual(width60, Math.Round(result.Width, 2));
            Assert.AreEqual(height60, Math.Round(result.Height, 2));

            result = LayoutHelper.GetSizeAtAngle(size, 150.0);
            Assert.AreEqual(width30, Math.Round(result.Width, 2));
            Assert.AreEqual(height30, Math.Round(result.Height, 2));

            result = LayoutHelper.GetSizeAtAngle(size, -30.0);
            Assert.AreEqual(width30, Math.Round(result.Width, 2));
            Assert.AreEqual(height30, Math.Round(result.Height, 2));

            result = LayoutHelper.GetSizeAtAngle(size, -60.0);
            Assert.AreEqual(width60, Math.Round(result.Width, 2));
            Assert.AreEqual(height60, Math.Round(result.Height, 2));

            result = LayoutHelper.GetSizeAtAngle(size, -120.0);
            Assert.AreEqual(width60, Math.Round(result.Width, 2));
            Assert.AreEqual(height60, Math.Round(result.Height, 2));

            result = LayoutHelper.GetSizeAtAngle(size, -150.0);
            Assert.AreEqual(width30, Math.Round(result.Width, 2));
            Assert.AreEqual(height30, Math.Round(result.Height, 2));
        }

        [TestMethod]
        public void Test_000_Degrees()
        {
            const double angle = 0.0;

            Point result;
            result = LayoutHelper.GetLeftTopAtAngle(size, angle, center);
            Assert.AreEqual(-50.0, Math.Round(result.X, 2));
            Assert.AreEqual(-30.0, Math.Round(result.Y, 2));

            result = LayoutHelper.GetLeftTopAtAngle(size, angle, left);
            Assert.AreEqual(0.0, Math.Round(result.X, 2));
            Assert.AreEqual(-30.0, Math.Round(result.Y, 2));

            result = LayoutHelper.GetLeftTopAtAngle(size, angle, right);
            Assert.AreEqual(-100.0, Math.Round(result.X, 2));
            Assert.AreEqual(-30.0, Math.Round(result.Y, 2));

            result = LayoutHelper.GetLeftTopAtAngle(size, angle, top);
            Assert.AreEqual(-50.0, Math.Round(result.X, 2));
            Assert.AreEqual(0.0, Math.Round(result.Y, 2));

            result = LayoutHelper.GetLeftTopAtAngle(size, angle, bottom);
            Assert.AreEqual(-50.0, Math.Round(result.X, 2));
            Assert.AreEqual(-60.0, Math.Round(result.Y, 2));

            result = LayoutHelper.GetLeftTopAtAngle(size, angle, leftTop);
            Assert.AreEqual(0.0, Math.Round(result.X, 2));
            Assert.AreEqual(0.0, Math.Round(result.Y, 2));

            result = LayoutHelper.GetLeftTopAtAngle(size, angle, rightTop);
            Assert.AreEqual(-100.0, Math.Round(result.X, 2));
            Assert.AreEqual(0.0, Math.Round(result.Y, 2));

            result = LayoutHelper.GetLeftTopAtAngle(size, angle, leftBottom);
            Assert.AreEqual(0.0, Math.Round(result.X, 2));
            Assert.AreEqual(-60.0, Math.Round(result.Y, 2));

            result = LayoutHelper.GetLeftTopAtAngle(size, angle, rightBottom);
            Assert.AreEqual(-100.0, Math.Round(result.X, 2));
            Assert.AreEqual(-60.0, Math.Round(result.Y, 2));            
		}

        //[TestMethod]
        //public void Test_045_Degrees()
        //{
        //    const double angle = 45.0;

        //    Point result;
        //    result = LayoutHelper.GetLeftTopAtAngle(size, angle, center);
        //    Assert.AreEqual(dim45 * 0.5, Math.Round(result.X, 2));
        //    Assert.AreEqual(dim45 * 0.5, Math.Round(result.Y, 2));

        //    result = LayoutHelper.GetLeftTopAtAngle(size, angle, left);
        //    Assert.AreEqual(Math.Round(30 / Math.Sqrt(2), 2), Math.Round(result.X, 2));
        //    Assert.AreEqual(Math.Round(130 / Math.Sqrt(2), 2), Math.Round(result.Y, 2));

        //    result = LayoutHelper.GetLeftTopAtAngle(size, angle, right);
        //    Assert.AreEqual(Math.Round(130 / Math.Sqrt(2), 2), Math.Round(result.X, 2));
        //    Assert.AreEqual(Math.Round(30 / Math.Sqrt(2), 2), Math.Round(result.Y, 2));

        //    result = LayoutHelper.GetLeftTopAtAngle(size, angle, top);
        //    Assert.AreEqual(Math.Round(50 / Math.Sqrt(2), 2), Math.Round(result.X, 2));
        //    Assert.AreEqual(Math.Round(50 / Math.Sqrt(2), 2), Math.Round(result.Y, 2));

        //    result = LayoutHelper.GetLeftTopAtAngle(size, angle, bottom);
        //    Assert.AreEqual(Math.Round(110 / Math.Sqrt(2), 2), Math.Round(result.X, 2));
        //    Assert.AreEqual(Math.Round(dim45 - 50 / Math.Sqrt(2), 2), Math.Round(result.Y, 2));

        //    result = LayoutHelper.GetLeftTopAtAngle(size, angle, leftTop);
        //    Assert.AreEqual(0.0, Math.Round(result.X, 2));
        //    Assert.AreEqual(Math.Round(100 / Math.Sqrt(2), 2), Math.Round(result.Y, 2));

        //    result = LayoutHelper.GetLeftTopAtAngle(size, angle, rightTop);
        //    Assert.AreEqual(Math.Round(100 / Math.Sqrt(2), 2), Math.Round(result.X, 2));
        //    Assert.AreEqual(0.0, Math.Round(result.Y, 2));

        //    result = LayoutHelper.GetLeftTopAtAngle(size, angle, leftBottom);
        //    Assert.AreEqual(Math.Round(60 / Math.Sqrt(2), 2), Math.Round(result.X, 2));
        //    Assert.AreEqual(Math.Round(160 / Math.Sqrt(2), 2), Math.Round(result.Y, 2));

        //    result = LayoutHelper.GetLeftTopAtAngle(size, angle, rightBottom);
        //    Assert.AreEqual(Math.Round(160 / Math.Sqrt(2), 2), Math.Round(result.X, 2));
        //    Assert.AreEqual(Math.Round(60 / Math.Sqrt(2), 2), Math.Round(result.Y, 2));
        //}
        [TestMethod]
        public void Test_045_Degrees()
        {
            const double angle = 45.0;
            Point result;

            result = LayoutHelper.GetLeftTopAtAngle(size, angle, center);
            Assert.AreEqual(-dim45 * 0.5, Math.Round(result.X, 2));
            Assert.AreEqual(-dim45 * 0.5, Math.Round(result.Y, 2));

            result = LayoutHelper.GetLeftTopAtAngle(size, angle, left);
            Assert.AreEqual(-Math.Round(30 / Math.Sqrt(2), 2), Math.Round(result.X, 2));
            Assert.AreEqual(-Math.Round(130 / Math.Sqrt(2), 2), Math.Round(result.Y, 2));

            result = LayoutHelper.GetLeftTopAtAngle(size, angle, right);
            Assert.AreEqual(-Math.Round(130 / Math.Sqrt(2), 2), Math.Round(result.X, 2));
            Assert.AreEqual(-Math.Round(30 / Math.Sqrt(2), 2), Math.Round(result.Y, 2));

            result = LayoutHelper.GetLeftTopAtAngle(size, angle, top);
            Assert.AreEqual(-Math.Round(50 / Math.Sqrt(2), 2), Math.Round(result.X, 2));
            Assert.AreEqual(-Math.Round(50 / Math.Sqrt(2), 2), Math.Round(result.Y, 2));

            result = LayoutHelper.GetLeftTopAtAngle(size, angle, bottom);
            Assert.AreEqual(-Math.Round(110 / Math.Sqrt(2), 2), Math.Round(result.X, 2));
            Assert.AreEqual(-Math.Round(dim45 - 50 / Math.Sqrt(2), 2), Math.Round(result.Y, 2));

            result = LayoutHelper.GetLeftTopAtAngle(size, angle, leftTop);
            Assert.AreEqual(0.0, Math.Round(result.X, 2));
            Assert.AreEqual(-Math.Round(100 / Math.Sqrt(2), 2), Math.Round(result.Y, 2));

            result = LayoutHelper.GetLeftTopAtAngle(size, angle, rightTop);
            Assert.AreEqual(-Math.Round(100 / Math.Sqrt(2), 2), Math.Round(result.X, 2));
            Assert.AreEqual(0.0, Math.Round(result.Y, 2));

            result = LayoutHelper.GetLeftTopAtAngle(size, angle, leftBottom);
            Assert.AreEqual(-Math.Round(60 / Math.Sqrt(2), 2), Math.Round(result.X, 2));
            Assert.AreEqual(-Math.Round(160 / Math.Sqrt(2), 2), Math.Round(result.Y, 2));

            result = LayoutHelper.GetLeftTopAtAngle(size, angle, rightBottom);
            Assert.AreEqual(-Math.Round(160 / Math.Sqrt(2), 2), Math.Round(result.X, 2));
            Assert.AreEqual(-Math.Round(60 / Math.Sqrt(2), 2), Math.Round(result.Y, 2));
        }

        [TestMethod]
        public void Test_135_Degrees()
        {
            const double angle = 135.0;
            Point result;

            result = LayoutHelper.GetLeftTopAtAngle(size, angle, center);
            Assert.AreEqual(-dim45 * 0.5, Math.Round(result.X, 2));
            Assert.AreEqual(-dim45 * 0.5, Math.Round(result.Y, 2));

            result = LayoutHelper.GetLeftTopAtAngle(size, angle, left);
            Assert.AreEqual(-Math.Round(130 / Math.Sqrt(2), 2), Math.Round(result.X, 2));
            Assert.AreEqual(-Math.Round(130 / Math.Sqrt(2), 2), Math.Round(result.Y, 2));            
 
            result = LayoutHelper.GetLeftTopAtAngle(size, angle, right);
            Assert.AreEqual(-Math.Round(30 / Math.Sqrt(2), 2), Math.Round(result.X, 2));
            Assert.AreEqual(-Math.Round(30 / Math.Sqrt(2), 2), Math.Round(result.Y, 2));
            
            result = LayoutHelper.GetLeftTopAtAngle(size, angle, top);
            Assert.AreEqual(-Math.Round(50 / Math.Sqrt(2), 2), Math.Round(result.X, 2));
            Assert.AreEqual(-Math.Round(110 / Math.Sqrt(2), 2), Math.Round(result.Y, 2));

            result = LayoutHelper.GetLeftTopAtAngle(size, angle, bottom);
            Assert.AreEqual(-Math.Round(110 / Math.Sqrt(2), 2), Math.Round(result.X, 2));
            Assert.AreEqual(-Math.Round(50 / Math.Sqrt(2), 2), Math.Round(result.Y, 2));

            result = LayoutHelper.GetLeftTopAtAngle(size, angle, leftTop);
            Assert.AreEqual(-Math.Round(100 / Math.Sqrt(2), 2), Math.Round(result.X, 2));
            Assert.AreEqual(-Math.Round(160 / Math.Sqrt(2), 2), Math.Round(result.Y, 2));

            result = LayoutHelper.GetLeftTopAtAngle(size, angle, rightTop);
            Assert.AreEqual(0.0, Math.Round(result.X, 2));
            Assert.AreEqual(-Math.Round(60 / Math.Sqrt(2), 2), Math.Round(result.Y, 2));
            
            result = LayoutHelper.GetLeftTopAtAngle(size, angle, leftBottom);
            Assert.AreEqual(-Math.Round(160 / Math.Sqrt(2), 2), Math.Round(result.X, 2));
            Assert.AreEqual(-Math.Round(100 / Math.Sqrt(2), 2), Math.Round(result.Y, 2));

            result = LayoutHelper.GetLeftTopAtAngle(size, angle, rightBottom);
            Assert.AreEqual(-Math.Round(60 / Math.Sqrt(2), 2), Math.Round(result.X, 2));
            Assert.AreEqual(0.0, Math.Round(result.Y, 2));
        }

       
        [TestMethod]
        public void Test_M_045_Degrees()
        {
            const double angle = -45.0;

            Point result;
            result = LayoutHelper.GetLeftTopAtAngle(size, angle, center);
            Assert.AreEqual(-dim45 * 0.5, Math.Round(result.X, 2));
            Assert.AreEqual(-dim45 * 0.5, Math.Round(result.Y, 2));

            result = LayoutHelper.GetLeftTopAtAngle(size, angle, left);
            Assert.AreEqual(-Math.Round(30 / Math.Sqrt(2), 2), Math.Round(result.X, 2));
            Assert.AreEqual(-Math.Round(30 / Math.Sqrt(2), 2), Math.Round(result.Y, 2));

            result = LayoutHelper.GetLeftTopAtAngle(size, angle, right);
            Assert.AreEqual(-Math.Round(130 / Math.Sqrt(2), 2), Math.Round(result.X, 2));
            Assert.AreEqual(-Math.Round(130 / Math.Sqrt(2), 2), Math.Round(result.Y, 2));

            result = LayoutHelper.GetLeftTopAtAngle(size, angle, top);
            Assert.AreEqual(-Math.Round(110 / Math.Sqrt(2), 2), Math.Round(result.X, 2));
            Assert.AreEqual(-Math.Round(50 / Math.Sqrt(2), 2), Math.Round(result.Y, 2));

            result = LayoutHelper.GetLeftTopAtAngle(size, angle, bottom);
            Assert.AreEqual(-Math.Round(50 / Math.Sqrt(2), 2), Math.Round(result.X, 2));
            Assert.AreEqual(-Math.Round(110 / Math.Sqrt(2), 2), Math.Round(result.Y, 2));

            result = LayoutHelper.GetLeftTopAtAngle(size, angle, leftTop);
            Assert.AreEqual(-Math.Round(60 / Math.Sqrt(2), 2), Math.Round(result.X, 2));
            Assert.AreEqual(0.0, Math.Round(result.Y, 2));

            result = LayoutHelper.GetLeftTopAtAngle(size, angle, rightTop);
            Assert.AreEqual(-dim45, Math.Round(result.X, 2));
            Assert.AreEqual(-Math.Round(100 / Math.Sqrt(2), 2), Math.Round(result.Y, 2));

            result = LayoutHelper.GetLeftTopAtAngle(size, angle, leftBottom);
            Assert.AreEqual(0.0, Math.Round(result.X, 2));
            Assert.AreEqual(-Math.Round(60 / Math.Sqrt(2), 2), Math.Round(result.Y, 2));

            result = LayoutHelper.GetLeftTopAtAngle(size, angle, rightBottom);
            Assert.AreEqual(-Math.Round(100 / Math.Sqrt(2), 2), Math.Round(result.X, 2));
            Assert.AreEqual(-dim45, Math.Round(result.Y, 2));
        }


        [TestMethod]
        public void Test_M_090_Degrees()
        {
            const double angle = -90;
            Point result;
            result = LayoutHelper.GetLeftTopAtAngle(size, angle, center);
            Assert.AreEqual(-30.0, Math.Round(result.X, 2));
            Assert.AreEqual(-50.0, Math.Round(result.Y, 2));

            result = LayoutHelper.GetLeftTopAtAngle(size, angle, left);
            Assert.AreEqual(-30.0, Math.Round(result.X, 2));
            Assert.AreEqual(0.0, Math.Round(result.Y, 2));

            result = LayoutHelper.GetLeftTopAtAngle(size, angle, right);
            Assert.AreEqual(-30.0, Math.Round(result.X, 2));
            Assert.AreEqual(-100.0, Math.Round(result.Y, 2));

            result = LayoutHelper.GetLeftTopAtAngle(size, angle, top);
            Assert.AreEqual(-60.0, Math.Round(result.X, 2));
            Assert.AreEqual(-50.0, Math.Round(result.Y, 2));

            result = LayoutHelper.GetLeftTopAtAngle(size, angle, bottom);
            Assert.AreEqual(0.0, Math.Round(result.X, 2));
            Assert.AreEqual(-50.0, Math.Round(result.Y, 2));

            result = LayoutHelper.GetLeftTopAtAngle(size, angle, leftTop);
            Assert.AreEqual(-60.0, Math.Round(result.X, 2));
            Assert.AreEqual(0.0, Math.Round(result.Y, 2));

            result = LayoutHelper.GetLeftTopAtAngle(size, angle, rightTop);
            Assert.AreEqual(-60.0, Math.Round(result.X, 2));
            Assert.AreEqual(-100.0, Math.Round(result.Y, 2));

            result = LayoutHelper.GetLeftTopAtAngle(size, angle, leftBottom);
            Assert.AreEqual(0.0, Math.Round(result.X, 2));
            Assert.AreEqual(0.0, Math.Round(result.Y, 2));

            result = LayoutHelper.GetLeftTopAtAngle(size, angle, rightBottom);
            Assert.AreEqual(0.0, Math.Round(result.X, 2));
            Assert.AreEqual(-100.0, Math.Round(result.Y, 2));
        }

        [TestMethod]
        public void Test_090_Degrees()
        {
            const double angle = 90;
            Point result;
            result = LayoutHelper.GetLeftTopAtAngle(size, angle, center);
            Assert.AreEqual(-30.0, Math.Round(result.X, 2));
            Assert.AreEqual(-50.0, Math.Round(result.Y, 2));

            result = LayoutHelper.GetLeftTopAtAngle(size, angle, left);
            Assert.AreEqual(-30.0, Math.Round(result.X, 2));
            Assert.AreEqual(-100.0, Math.Round(result.Y, 2));

            result = LayoutHelper.GetLeftTopAtAngle(size, angle, right);
            Assert.AreEqual(-30.0, Math.Round(result.X, 2));
            Assert.AreEqual(0.0, Math.Round(result.Y, 2));

            result = LayoutHelper.GetLeftTopAtAngle(size, angle, top);
            Assert.AreEqual(0.0, Math.Round(result.X, 2));
            Assert.AreEqual(-50.0, Math.Round(result.Y, 2));

            result = LayoutHelper.GetLeftTopAtAngle(size, angle, bottom);
            Assert.AreEqual(-60.0, Math.Round(result.X, 2));
            Assert.AreEqual(-50.0, Math.Round(result.Y, 2));

            result = LayoutHelper.GetLeftTopAtAngle(size, angle, leftTop);
            Assert.AreEqual(0.0, Math.Round(result.X, 2));
            Assert.AreEqual(-100.0, Math.Round(result.Y, 2));

            result = LayoutHelper.GetLeftTopAtAngle(size, angle, rightTop);
            Assert.AreEqual(0.0, Math.Round(result.X, 2));
            Assert.AreEqual(0.0, Math.Round(result.Y, 2));

            result = LayoutHelper.GetLeftTopAtAngle(size, angle, leftBottom);
            Assert.AreEqual(-60.0, Math.Round(result.X, 2));
            Assert.AreEqual(-100.0, Math.Round(result.Y, 2));

            result = LayoutHelper.GetLeftTopAtAngle(size, angle, rightBottom);
            Assert.AreEqual(-60.0, Math.Round(result.X, 2));
            Assert.AreEqual(0.0, Math.Round(result.Y, 2));
        }


        [TestMethod]
        public void Test_030_Degrees()
        {
            Test_Acutes(30);
        }

        [TestMethod]
        public void Test_060_Degrees()
        {
            Test_Acutes(60);
        }

        private void Test_Acutes(double acuteAngle)
        {
            double radians = MathHelper.Radians(acuteAngle);

            Point result;
            result = LayoutHelper.GetLeftTopAtAngle(size, acuteAngle, center);
            Assert.AreEqual(-Math.Round((100.0 * Math.Cos(radians) + 60.0 * Math.Sin(radians)) * 0.5, 2), Math.Round(result.X, 2));
            Assert.AreEqual(-Math.Round((100.0 * Math.Sin(radians) + 60.0 * Math.Cos(radians)) * 0.5, 2), Math.Round(result.Y, 2));

            result = LayoutHelper.GetLeftTopAtAngle(size, acuteAngle, left);
            Assert.AreEqual(-Math.Round(30.0 * Math.Sin(radians), 2), Math.Round(result.X, 2));
            Assert.AreEqual(-Math.Round(100.0 * Math.Sin(radians) + 30.0 * Math.Cos(radians), 2), Math.Round(result.Y, 2));

            result = LayoutHelper.GetLeftTopAtAngle(size, acuteAngle, right);
            Assert.AreEqual(-Math.Round(100.0 * Math.Cos(radians) + 30.0 * Math.Sin(radians), 2), Math.Round(result.X, 2));
            Assert.AreEqual(-Math.Round(30.0 * Math.Cos(radians), 2), Math.Round(result.Y, 2));

            result = LayoutHelper.GetLeftTopAtAngle(size, acuteAngle, top);
            Assert.AreEqual(-Math.Round(50.0 * Math.Cos(radians), 2), Math.Round(result.X, 2));
            Assert.AreEqual(-Math.Round(50.0 * Math.Sin(radians), 2), Math.Round(result.Y, 2));

            result = LayoutHelper.GetLeftTopAtAngle(size, acuteAngle, bottom);
            Assert.AreEqual(-Math.Round(50.0 * Math.Cos(radians) + 60.0 * Math.Sin(radians), 2), Math.Round(result.X, 2));
            Assert.AreEqual(-Math.Round(60.0 * Math.Cos(radians) + 50.0 * Math.Sin(radians), 2), Math.Round(result.Y, 2));

            result = LayoutHelper.GetLeftTopAtAngle(size, acuteAngle, leftTop);
            Assert.AreEqual(0.0, Math.Round(result.X, 2));
            Assert.AreEqual(-Math.Round(100.0 * Math.Sin(radians), 2), Math.Round(result.Y, 2));

            result = LayoutHelper.GetLeftTopAtAngle(size, acuteAngle, rightTop);
            Assert.AreEqual(-Math.Round(100.0 * Math.Cos(radians), 2), Math.Round(result.X, 2));
            Assert.AreEqual(0.0, Math.Round(result.Y, 2));

            result = LayoutHelper.GetLeftTopAtAngle(size, acuteAngle, leftBottom);
            Assert.AreEqual(-Math.Round(60.0 * Math.Sin(radians), 2), Math.Round(result.X, 2));
            Assert.AreEqual(-Math.Round(100.0 * Math.Sin(radians) + 60.0 * Math.Cos(radians), 2), Math.Round(result.Y, 2));

            result = LayoutHelper.GetLeftTopAtAngle(size, acuteAngle, rightBottom);
            Assert.AreEqual(-Math.Round(100.0 * Math.Cos(radians) + 60.0 * Math.Sin(radians), 2), Math.Round(result.X, 2));
            Assert.AreEqual(-Math.Round(60.0 * Math.Cos(radians), 2), Math.Round(result.Y, 2));
        }


        

        // OBSOLETE APPROACH
        //[TestMethod]
        //public void Test_M_090_Degrees()
        //{
        //    const double angle = -90.0;

        //    Point result;
        //    result = LayoutHelper.GetLeftTopAtAngle(size, angle, center);
        //    Assert.AreEqual(-30.0, Math.Round(result.X, 2));
        //    Assert.AreEqual(-50.0, Math.Round(result.Y, 2));

        //    result = LayoutHelper.GetLeftTopAtAngle(size, angle, left);
        //    Assert.AreEqual(-30.0, Math.Round(result.X, 2));
        //    Assert.AreEqual(-100.0, Math.Round(result.Y, 2));

        //    result = LayoutHelper.GetLeftTopAtAngle(size, angle, right);
        //    Assert.AreEqual(-30.0, Math.Round(result.X, 2));
        //    Assert.AreEqual(0.0, Math.Round(result.Y, 2));

        //    result = LayoutHelper.GetLeftTopAtAngle(size, angle, top);
        //    Assert.AreEqual(0.0, Math.Round(result.X, 2));
        //    Assert.AreEqual(-50.0, Math.Round(result.Y, 2));

        //    result = LayoutHelper.GetLeftTopAtAngle(size, angle, bottom);
        //    Assert.AreEqual(-60.0, Math.Round(result.X, 2));
        //    Assert.AreEqual(-50.0, Math.Round(result.Y, 2));

        //    result = LayoutHelper.GetLeftTopAtAngle(size, angle, leftTop);
        //    Assert.AreEqual(0.0, Math.Round(result.X, 2));
        //    Assert.AreEqual(-100.0, Math.Round(result.Y, 2));

        //    result = LayoutHelper.GetLeftTopAtAngle(size, angle, rightTop);
        //    Assert.AreEqual(0.0, Math.Round(result.X, 2));
        //    Assert.AreEqual(0.0, Math.Round(result.Y, 2));

        //    result = LayoutHelper.GetLeftTopAtAngle(size, angle, leftBottom);
        //    Assert.AreEqual(-60.0, Math.Round(result.X, 2));
        //    Assert.AreEqual(-100.0, Math.Round(result.Y, 2));

        //    result = LayoutHelper.GetLeftTopAtAngle(size, angle, rightBottom);
        //    Assert.AreEqual(-60.0, Math.Round(result.X, 2));
        //    Assert.AreEqual(0.0, Math.Round(result.Y, 2));
        //}

	}

    
}
